package org.bigdata.platform.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class FileUtil {
	public static List<String> readLinesFromTextFile(File file) throws Exception {
		return readLinesFromTextFile(new FileInputStream(file));
	}
	
	public static List<String> readLinesFromTextFile(InputStream is) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(is));
		ArrayList<String> lines = new ArrayList<String>();
		String line = null;
		while((line = r.readLine()) != null) {
			lines.add(line);
		}
		return lines;
	}
}
